home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / PRINTER / RISCRIPT / !RiScript / Fonts / Procedures < prev    next >
Text File  |  1994-06-24  |  1KB  |  54 lines

  1. %
  2. % RiScript font procedure definitions (30/10/93)
  3. %
  4.  
  5. % --- Define decoding dictionary from encoding vector
  6. % usage: <encoding> .decode
  7. /.decode {
  8.   256 dict dup
  9.   begin
  10.     0 1 255 {dup 3 index exch get exch def} for
  11.     /.notdef currentdict /space get def
  12.   end
  13. } def
  14.  
  15. % --- Define RISC OS (type 4) font
  16. % usage: <RiScipt font> <RISC OS font> <Encoding> <Decoding> type4font
  17. /type4font {
  18.   << /Decoding    3 -1 roll     
  19.      /Encoding    5 -1 roll
  20.      /RiscOsFont  7 -1 roll
  21.      /FontName    1 index
  22.      /FontType    4                    
  23.      /FontMatrix  [ 1 640 div 0 0 1 640 div 0 0 ]      
  24.      /FontBBox    [ 0 0 0 0 ]
  25.      /FID         null
  26.   >> definefont pop
  27. } def
  28.  
  29. % --- Map fonts
  30. % usage: <new name> <old name> <encoding> mapfont
  31. /mapfont {
  32.     exch findfont dup length dict begin
  33.     {1 index /FID ne {def} {pop pop} ifelse} forall
  34.     /Encoding exch def
  35.     currentdict end
  36.     definefont pop
  37. } def
  38.  
  39. % --- Load font
  40. % usage: <name> loadfont
  41. % post: true  if loading succeeded
  42. %       false if loading failed
  43. /loadfont {
  44.   /FontFiles dup where 
  45.   { exch get }
  46.   { (RiScript:Fonts.FontFiles) run load } ifelse
  47.   dup 2 index known 
  48.   { 1 index get (\(Loading ‘) print dup =
  49.                 (’ for ‘) print 1 index = 
  50.                 (’\)\n) print flush run}
  51.   { exch pop } ifelse
  52.   FontDirectory exch known
  53. } def
  54.